<?php
/**
 * Copyright 2008 francissem (http://www.webmoss.net)(francissem@gmail.com)
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 		http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @author francissem
 * @copyright 2008 francissem (http://www.webmoss.net)(francissem@gmail.com)
 * @license http://www.apache.org/licenses/LICENSE-2.0
 */
/**
 * Core_Repository_Data_Meta which for New Data write to Repository
 * Core_Repository_Data_Repos which is Existing Data read from Repository  
 */
abstract class Core_Repository_Data_Repos_Abstract extends Core_Repository_Data_Abstract implements Core_Repository_Data_Interface{
	protected $cursor;
	protected $repos;
	protected $data_info;
	function __construct(Core_Repository_Data_Info $info, Core_Repository_Abstract $repos){
		parent::__construct($info,$info->has_copies);
		$this->repos=$repos;
		$this->cursor = $info->cursor;
	}
	function getDataInfo(){
		return $this->getMeta();
	}
	
	function getContent($tag="_notag_",$timestamp=0){
		$restore_cursor = $this->repos->getCurrCursor();
		$this->repos->selectCursor($this->cursor);
		$content = $this->repos->readContent($tag,$timestamp);
		$this->repos->selectCursor($restore_cursor);
		return $this->unwrap($content);
	}
	
	function getRepository(){
		return $this->repos;
	}
	
	function unwrap($content){
		return $content;
	}
	
	function getAllCopiesTimestamp($tag=null){
		$restore_cursor = $this->repos->getCurrCursor();
		$this->repos->selectCursor($this->cursor);
		$timestamps = $this->repos->getAllCopiesTimestamp($tag);
		$this->repos->selectCursor($restore_cursor);
		return $timestamps;
	}
	
}
?>